<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<script language="javascript">

function choicetest(name, num) {
  var choicearr = document.getElementsByName(name);
  var a = 0;
  for(var i = 0; i < choicearr.length; i++) {
    if(choicearr[i].checked) {
      a += 1
    }
  }
  if(a == num) {
    for(var i = 0; i < choicearr.length; i++) {
      if(!choicearr[i].checked) {
        choicearr[i].disabled = 'disabled'
      }
    }
  } else {
    for(var i = 0; i < choicearr.length; i++) {
      choicearr[i].removeAttribute('disabled')
    }
  }
}

</script>

<body>
  <div width="513" onclick="choicetest('choice',3)">
    <label><input type="checkbox" name="choice" id="choice" width="30px;" /></label>选择1
    <label><input type="checkbox" name="choice" id="choice" width="30px;" /></label>选择2
    <label><input type="checkbox" name="choice" id="choice" width="30px;" /></label>选择3
    <label><input type="checkbox" name="choice" id="choice" width="30px;" /></label>选择4
    <label><input type="checkbox" name="choice" id="choice" width="30px;" /></label>选择5
    <label><input type="checkbox" name="choice" id="choice" width="30px;" /></label>选择6
    <label><input type="checkbox" name="choice" id="choice" width="30px;" /></label>选择7
    <label><input type="checkbox" name="choice" id="choice" width="30px;" /></label>选择8
    <label><input type="checkbox" name="choice" id="choice" width="30px;" /></label>选择9
    <label><input type="checkbox" name="choice" id="choice" width="30px;" /></label>选择10</div>
</body>


</html>